Skip to content

Make retrieve context a renderer with named formats and labels as data - #702

Merged
arrry-hydraDB merged 3 commits into
hydra-db:mainfrom
jaywyawhare:feat/context-renderer
Dec 5, 2026
Merged

arrry-hydraDB merged 3 commits into
hydra-db:mainfrom
jaywyawhare:feat/context-renderer

Conversation

@jaywyawhare

@jaywyawhare jaywyawhare commented Dec 4, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Make retrieve context a renderer with named formats and labels as data. prompt stays the default and its exact text is preserved; prompt, compact, markdown, and json are selectable through context_format on the API and MCP and --context-format on both CLIs, and record labels like certified and via_hub are carried as structured data rather than baked-in strings.

Implementation details

Decisions

  • Keep prompt as the default and preserve its text, escaping, numbering, and truncation.
  • Expose prompt, compact, markdown, and json through context_format in both SDKs and MCP, and through --context-format in both CLIs.
  • Carry certified and via_hub as structured record labels.
  • Give synchronous custom renderers the subgraph and the same ordered records the built-in formats use.

Validation

  • Four new tests fail on base; the conformance pair is updated.
  • scripts/precheck.py passes (644 changed lines, clean trial merge). Full suites on Kuzu pass, apart from the existing macOS pipe test in cli.test.ts; one large-entity TypeScript case timed out under the full run and passed in isolation.
  • Ruff lint and format, TypeScript lint, typecheck, and build pass.

Limits

The prompt token budget selects records for every format, so alternate formatting can change the final token count. Invalid selectors reuse invalid_argument.

Linked issue

Closes #670

AI Assistance

AI tools helped write and test parts of this. I reviewed and ran every change.

Checklist

  • Implements an issue a maintainer has /approved.
  • Small and scoped to that issue.
  • New errors have a code and hint, the same on API, CLI, and MCP in both SDKs (see AGENTS.md). No new codes; reuses invalid_argument.
  • Breaking changes described below, or none.

Breaking changes

None.


Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

@arrry-hydraDB arrry-hydraDB added feature New capability area: retrieval search, BM25, embeddings, terms, diff reads effort: L Design change or many modules labels Dec 4, 2026
@arrry-hydraDB
arrry-hydraDB marked this pull request as ready for review December 4, 2026 22:29

@arrry-hydraDB arrry-hydraDB left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@arrry-hydraDB
arrry-hydraDB merged commit fa4b503 into hydra-db:main Dec 5, 2026
50 checks passed
@arrry-hydraDB arrry-hydraDB mentioned this pull request Dec 5, 2026
4 tasks done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: retrieval search, BM25, embeddings, terms, diff reads effort: L Design change or many modules feature New capability

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make retrieve context a renderer with named formats and labels as data

2 participants